﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Dynamic;
using M;
using Mysoft.MyCM;
using Mysoft.MyCM.Scm;
using Mysoft.MyCM.RptCm;
using Mysoft.MyCM.Business;
using Mysoft.MyCM.Business.Scm;

namespace Mysoft.MyCM.Web.Controllers
{
	public class RptCmController : MFunViewBaseController
	{
		// GET: RptCM
		public ActionResult Index(string param)
        {
			if (string.IsNullOrEmpty(param)) param = "Unknown";
			ReportType rptType = ReportType.Unknown;
			try
			{
				rptType = (ReportType)Enum.Parse(typeof(ReportType), param, true);
			}
			catch
			{
				throw new MException(string.Format("服务器没有匹配到类型为 {0} 的报表哦~", param));
			}
			// 获取客户信息
			CustomBLL cstBLL = new CustomBLL();
			// 获取客户详细信息
			Custom cst = cstBLL.GetCustom(this.RequestParam.SelectedCustomerCode);

			dynamic model = new ExpandoObject();
			model.Customer = cst;

			// 设置标题
			ViewBag.Title = string.Format("{0} - 报表台账 - {1}报表", cst.CustomName, 
				(rptType== ReportType.Unknown) ? "所有" :
				((rptType== ReportType.Certificate) ? "认证" : "用户")
				);
            return View();
        }
	}
}